<%@page import="java.io.InputStreamReader"%>
<%@page import="java.io.InputStream"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>application 객체</title>
</head>
<body>

1. 서버 정보: <%= application.getServerInfo() %><br/>
2. 서블릿 API 버전 정보: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %><br/> 
3. 로그 기록 남김
<%
application.log("appl.jsp 실행");
//application.log("Exception 발생", new Exception());
%>
<br/>
4. JSP API 버전: <%= JspFactory.getDefaultFactory().getEngineInfo()
	.getSpecificationVersion() %>
<hr/>
[ 서버 자원 정보 ]<br/>
<%
String fileUri = "/image/소유.jpg";
%>
1. "<%= fileUri %>"의 Mime Type: <%= application.getMimeType(fileUri) %><br/>
2. "<%= fileUri %>"의 실제 경로: <%= application.getRealPath(fileUri) %><br/>

<hr/>
[ 서버 자원 InputStream 얻기 ]<br/>
<pre>
<%
String textFileUri = "/test.txt";

InputStream in = application.getResourceAsStream(textFileUri);
InputStreamReader reader = new InputStreamReader(in);

char[] cbuf = new char[1024];
int len = 0;
while ((len = reader.read(cbuf)) != -1) {
	out.write(cbuf, 0, len);
}
out.flush();
%>
</pre>

<hr/>
[ Context Parameter 예제 ]<br/>
appName: <%= application.getInitParameter("appName") %><br/>
appVersion: <%= application.getInitParameter("appVersion") %><br/>

</body>
</html>













